<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.slides.min.js"></script>
<script type="text/javascript">
$(function() {
    
    var urlPrefix = "${pageContext.request.contextPath}/api/";
	var advImageAPI = new AdvImageAPI({
		urlPrefix : urlPrefix
	});
	
	var memberLoginName = "<s:property value='memberInfo.memberLoginName' />";
	if (memberLoginName.length > 0) {
		$('#link_login').hide();
		$('#link_logout').show();
		$('#link_center').show();
		$('#link_regist').hide();
	} else {
		$('#link_login').show();
		$('#link_logout').hide();
		$('#link_center').hide();
		$('#link_regist').show();
	}
	$('#member_name').html(memberLoginName + "&nbsp;&nbsp;");
	
	getBannarImages({
	    onSuccess: function(images) {
	        $('#image_slider').remove();
        	$('#banner').append('<div id="image_slider"></div>');
        	$.each(images, function(index, row) {
        	    $('#image_slider').append('<img id="image' + (index + 1) + '" src="' + row.image + '" title="' + row.title + '" alt="' + row.description + '">');
            });

            initializePreview();
	    }
	});
	
	function getBannarImages(callback) {
		var paramData = {};
		paramData.use_flag = true;
		advImageAPI.search({
			onSuccess : function(data) {
			    if (callback) {
			        if (data.images) {
			            if (callback.onSuccess && typeof(callback.onSuccess) == "function") {
			                callback.onSuccess(data.images);
			            }
					} else {
					    if (callback.onError && typeof(callback.onError) == "function") {
			                callback.onError();
			            }
					}
			    }
			},
			onAPIError : function(status, errors) {
			},
			onServerError : function(jqXHR, textStatus, errorThrown) {
			}
		}, {
			param : JSON.stringify(paramData)
		});
	}

	function initializePreview() {
    	$("#image_slider").slidesjs({
            width: 1000,
            height: 200,
            start: 1,
            play: {
                active: false,
                effect: "slide",
                interval: 5000,
                auto: true,
                swap: false,
                pauseOnHover: true,
                restartDelay: 2500
            },
            navigation: {
                active: false
            },
            pagination: {
                active: false
            },
            effect: {
            	slide: {
            		speed: 1000
            	}
            }
        });
    }
});
</script>
    <div id="topbar">
      <div class="wp">
        <div class="left">
          <span id="member_name" style="font-weight:bold;"></span>
          <span>欢迎来到辽地集团网络集中采购平台！</span>
          <a id="link_login" href="${pageContext.request.contextPath}/forward/login" rel="nofollow" class="smart">登录</a>
          <a id="link_logout" href="${pageContext.request.contextPath}/forward/logout" rel="nofollow" class="smart">退出</a>
          <a id="link_center" href="${pageContext.request.contextPath}/forward/member_center" rel="nofollow" class="smart">会员中心</a>
          <a id="link_regist" href="${pageContext.request.contextPath}/forward/regist" rel="nofollow" class="smart">免费注册</a>
        </div>
        <div class="right">
          <span class="topbar_tel">服务热线：<span class="topbar_tel_no">XXXX-XXXXXXXX</span></span>
        </div>
      </div>
    </div>
    <div id="banner" style="margin-top: 5px; margin-bottom: 5px;">
      <div id="image_slider"></div>
    </div>
    <div class="navibar">
      <ul>
        <li><a href="${pageContext.request.contextPath}/forward/home">网站首页</a></li>
        <li><a href="${pageContext.request.contextPath}/forward/tender_search">招标检索</a></li>
        <li><a href="${pageContext.request.contextPath}/forward/news_notice?category=4">招标公告</a></li>
        <li><a href="${pageContext.request.contextPath}/forward/news_notice?category=5">招标预告</a></li>
        <li><a href="${pageContext.request.contextPath}/forward/news_notice?category=2">入围公告</a></li>
        <li><a href="${pageContext.request.contextPath}/forward/news_notice?category=3">中标公告</a></li>
        <li><a href="#">招标文件</a></li>
        <li><a href="${pageContext.request.contextPath}/forward/news_notice?category=1">新闻通告</a></li>
      </ul>
    </div>
